import yaml


def write_yaml(data):
    with open('../file/firstyaml.yml','a+',encoding='utf-8') as f :
        yaml.safe_dump(data,stream=f)


def read_yaml() :
    with open('../file/firstyaml.yml','r',encoding='utf-8') as f :
        data = yaml.safe_load(f)
        print(data)

def clear_yaml() :
    with open('../file/firstyaml.yml','w',encoding='utf_8') as f :
        f.truncate()

# def test_write_yaml() :
#     clear_yaml()
#     data = {
#         "name":"hangman",
#         'gender':"girl",
#         'number':1,
#         'number2':1.2,
#         'bool':True
#     }
#     write_yaml(data)
#
#     read_yaml()
#
#
# def test_write_yaml_list() :
#     clear_yaml()
#     data= {'data':'value'}
#     write_yaml(data)


